package com.kb.design.mapper.postgreSQL;

import com.kb.design.dto.ContractDTO;
import com.kb.design.dto.CustomContactInfo;
import com.kb.design.dto.DesignOrderDetailDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import com.kb.design.entity.DesignOrder;

import java.util.List;

@Mapper
public interface ContractMapper {

    @Select("select ConTractNumber AS contractNumber, Cust_code AS custCode, ContractDate AS contractDate, M_Total AS mTotal from iquotekb.dbo.NPCBContract with (nolock) WHERE ConTractNumber = #{contractNumber}")
    List<ContractDTO> selectByContractNumber(String contractNumber);


    @Select("SELECT t.LinkManName as customerContact, t.Email AS customerEmail, t.Mobile AS customerPhone " +
            "FROM LinkManOfCustomer t " +
            "LEFT JOIN Customer ON Customer.RecId = t.CustomerId " +
            "WHERE Customer.CustCode = #{code}")
    List<CustomContactInfo> queryCustomContactInfo(String code);

    @Select("SELECT tel as salePhone, email AS saleEmail,username as salesName FROM [dbo].[Xnh_UserInfo] WHERE usercode = #{code}")
    DesignOrderDetailDTO querySaleInfo(String code);
}